package com.woniuxy.orderServer.util;

import lombok.Data;

@Data
public class Result {
    //业务状态码
    private Integer code;
    //返回信息
    private String message;
    //判断是否成功
    private Boolean flag;
    //返回前端数据
    private Object data;
    
    //请求成功
    public static Result success(String message, Object data) {
        Result result = new Result();
        result.setCode(200);
        result.setFlag(true);
        result.setMessage(message);
        result.setData(data);
        return result;
    }
    //请求失败
    public static Result fail(Integer code, String message) {
        Result result = new Result();
        result.setCode(code);
        result.setFlag(false);
        result.setMessage(message);
        return result;
    }
}
